package com.wulis.common.model.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 树形结构父级实体类
 * 
 * @author WuliBao
 */
@Data
@Accessors(chain = true)
public class Node<T extends Node<T>> {

    @Schema(description = "节点ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Schema(description = "父节点ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    @Schema(description = "子节点")
    private List<T> nodes;
}
